package com.hspedu.newData.LCR;
/**
 * @Author: yh
 * @description: 
 * @CreateTime: 2025-05-20 
 * @Version: 1.0
 */

public class LCR88使用最小花费爬楼梯 {

    public int minCostClimbingStairs(int[] cost) {

        int[] dp = new int[cost.length + 1];

        for (int i = 2; i <= cost.length; i++) {
            dp[i] = Math.min(dp[i-2]+cost[i-2],dp[i-1]+cost[i-1]);
        }

        return dp[cost.length];

    }
}
